Fixes to emacsclient.c for GNU/Linux.
authorJuanma Barranquero <lekktu@gmail.com>
Tue, 31 Oct 2006 09:07:18 +0000 (09:07 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Tue, 31 Oct 2006 09:07:18 +0000 (09:07 +0000)
[!WINDOWSNT] <top level>: Include <netinet/in.h> and <sys/ioctl.h>.
(INVALID_SOCKET): Define.
(initialize_sockets): Put #endif at the right place.
(set_local_socket): Use progname, not argv[0].

lib-src/emacsclient.c

index 943053b3c0fd44a11a3da53fc9dcc4a4b3997cfc..b3a5180653c51cf7af863b70a75d43980879c285 100644 (file)
@@ -38,6 +38,9 @@ Boston, MA 02110-1301, USA.  */
 # define INITIALIZE() (initialize_sockets ())
 typedef unsigned long IOCTL_BOOL_ARG;
 #else
+# include <netinet/in.h>
+# include <sys/ioctl.h>
+# define INVALID_SOCKET -1
 # define HSOCKET int
 # define CLOSE_SOCKET close
 # define IOCTL ioctl
@@ -390,8 +393,8 @@ void initialize_sockets ()
     }
 
   atexit (close_winsock);
-#endif /* WINDOWSNT */
 }
+#endif /* WINDOWSNT */
 \f
 /*
  * Read the information needed to set up a TCP comm channel with
@@ -618,7 +621,7 @@ set_local_socket ()
            we are root. */
         if (0 != geteuid ())
           {
-            fprintf (stderr, "%s: Invalid socket owner\n", argv[0]);
+            fprintf (stderr, "%s: Invalid socket owner\n", progname);
            return INVALID_SOCKET;
           }
         break;